package com.tony.mindwarning.service.impl;

import com.tony.mindwarning.mpper.ProductMapper;
import com.tony.mindwarning.pojo.Product;
import com.tony.mindwarning.pojo.ProductInfo;
import com.tony.mindwarning.service.ProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: ProductServiceImpl
 * @Auther: 皮蛋布丁
 * @Date: 2021/04/09/10:01
 * @Description:
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    ProductMapper productMapper;

    @Override
    public int addProduct(Product product,int userId) {
        return productMapper.addProduct(product,userId);
    }

    @Override
    public int totalCount() {
        return productMapper.totalCount();
    }

    @Override
    public List<Product> getProductByPage(Map<String, Object> map) {
        return productMapper.getProductByPage(map);
    }

    @Override
    public Product findById(Integer pid) {
        return productMapper.findById(pid);
    }

    @Override
    public Integer updateProduct(Product product,int userId) {
        return productMapper.updateProduct(product,userId);
    }

    @Override
    public int deleteProduct(int pid,int userId) {
        return productMapper.deleteProduct(pid,userId);
    }

    @Override
    public List<ProductInfo> getProductInfos() {
        return productMapper.getProductInfos();
    }

    @Override
    public int updateProductCount(Product product,int userId) {
        return productMapper.updateProductCount(product,userId);
    }

    @Override
    public List<Product> productsByTid(Integer tid) {
        return productMapper.productsByTid(tid);
    }
}
